package com.example.takeaway.api;

import com.example.takeaway.common.R;
import com.example.takeaway.context.UserInfoContext;
import com.example.takeaway.model.vo.DashboardVO;
import com.example.takeaway.service.DashboardService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 邢晨旭
 * {@code @date} 2023/10/26
 */
@RestController
@RequestMapping("/dashboard")
public class DashboardApi {

    @Resource
    DashboardService dashboardService;

    @GetMapping
    public R<DashboardVO> getDashboard() {
        //todo 获取shopId
        Long shopId = UserInfoContext.get().getUserId();
        return R.ok(dashboardService.getDashboard(shopId));
    }

}
